package test;

/**
 * @author oldliu
 * @since 1.0
 */
import java.util.Scanner;

//公司类
// 属性：注册地址，电话，经营范围，员工组，客户组
//方法：招聘员工，输出员工信息，辞退员工，修改客户姓名
public class Gongsi {
    String dizhi;
    int dianhuahaoma;
    String jingyingfanwei;

    String[] yuangong = new String[30];  //30个员工小公司

    String[] kehu = new String[100];  //只有100个客户

    Scanner in = new Scanner(System.in);

    public void shuchugongsi() {
        System.out.println("地址是" + dizhi);
        System.out.println("电话号码是" + dianhuahaoma);
        System.out.println("经营范围是" + jingyingfanwei);
    }

    public void addkehu(String kehuxingming) {
        for (int i = 0; i < kehu.length; i++) {
            if(kehu[i]==null){
                continue;
            }
            if (kehu[i].equals(kehuxingming)) {
                System.out.println("已存在的客户！");
                return;
            }
        }
        for (int i = 0; i < kehu.length; i++) {
            if (kehu[i] == null) {
                kehu[i] = kehuxingming;
                return;
            }
        }
        System.out.println("客户已满100人");
    }

    public void deletekehu(String kehuxingming) {
        for (int i = 0; i < kehu.length; i++) {
            if (kehu[i].equals(kehuxingming)) {
                kehu[i]=null;
                System.out.println("删除成功");
                return;
            }
        }
        System.out.println("没有这个客户");
    }

    public String findkehu(int index){
        if (kehu[index]==null){
            System.out.println("当前位置没有客户");
            return null;
        }
        return kehu[index];
    }

    public void addyuangong(String name) {
        for (int i = 0; i < yuangong.length; i++) {
            if(yuangong[i]==null){
                continue;
            }
            if (yuangong[i].equals(name)) {
                System.out.println("已存在的员工！");
                return;
            }
        }
        for (int i = 0; i < yuangong.length; i++) {
            if (yuangong[i] == null) {
                yuangong[i] = name;
                return;
            }
        }
        System.out.println("员工已满30人");
    }

    public void deleteyuangong(String name) {
        for (int i = 0; i < yuangong.length; i++) {
            if(yuangong[i]==null){
                continue;
            }
            if (yuangong[i].equals(name)) {
                yuangong[i]=null;
                System.out.println("删除成功");
                return;
            }
        }
        System.out.println("没有这个员工");
    }

}



